package com.boco.dal.jmx.demo.config;

/**
 * 管理变量配置的线程<br>
 * MQ变量配置对象通过set方法注入<br>
 * 线程启动后，每隔5s打印一次配置变量
 * 
 * @author DAL.feng
 *
 */
public class ConfigPool extends Thread {

	private MqInfo mq;
	
	@Override
	public void run() {
		
		setName("ConfigPool-Thread");
		
		while(true) {
			
			System.out.println(mq.print());
			
			waitXsecond(5);
		}
		
	}
	
	private void waitXsecond(int x) {
		try {
			Thread.sleep(x * 1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public void setMq(MqInfo mq) {
		this.mq = mq;
	}
}
